package com.yycx.module.bus.provider.handler.haiying.tasktodo.settle;

import com.baomidou.dynamic.datasource.annotation.DSTransactional;
import com.yycx.bpm.provider.common.handler.ProcInstDeleteHandler;
import com.yycx.common.constants.CommonConstants;
import com.yycx.common.mybatis.model.ResultBody;
import com.yycx.module.bus.provider.service.BusPaymentService;
import com.yycx.module.bus.provider.service.hy.HyOrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 费用结算申请实例删除回调
 *
 * @author zyf
 */
@Component
@DSTransactional
@Slf4j
public class HySettlePayProcDeleteHandler implements ProcInstDeleteHandler {

    @Resource
    private BusPaymentService paymentService;

    @Override
    public boolean support(String processDefinitionKey) {
        return false;
    }

    @Override
    @DSTransactional
    public ResultBody success(String businessKey, String processInstanceId) {
        paymentService.updatePaymentState(Long.parseLong(businessKey), null, 0);
        return ResultBody.ok();
    }
}
